'use strict';

const Controller = require('egg').Controller;

class UploadController extends Controller {
    constructor(ctx) {
        super(ctx);
    }
    async index() {
        const { ctx, service } = this;

        const stream = await ctx.getFileStream();

        let url = await ctx.service.upload.upload(stream);

        ctx.body = { url };
    }

}

module.exports = UploadController;

